package app.srong.controller;

import app.srong.service.SubTopicService;
import app.srong.service.TopicService;
import app.srong.vo.SubTopic;
import app.srong.vo.Topic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/topic")
public class TopicController {

    @Autowired
    TopicService topicService;

    @Autowired
    SubTopicService subTopicService;


    //获取所有的主题
    @GetMapping("/allMap")
    public List< Topic> getTopicMap(){
        List<Topic> allTopicList = topicService.getAllTopicList();

        return allTopicList;
    }

    @GetMapping("/subTopicList")
    public List<SubTopic> subTopicList(Integer topicId){

        return subTopicService.subTopicList(topicId);
    }

}
